FROM golang:1.17-alpine3.16 AS builder

ENV GO111MODULE=on \
    GOPROXY=https://goproxy.cn,direct

COPY . /go/src/coolvar/server

WORKDIR /go/src/coolvar/server
RUN go install ./coolenv/...

FROM alpine:3.16
COPY --from=builder /go/bin/coolenv /bin/coolenv
ENV ADDR=:8081

EXPOSE 8081

ENTRYPOINT [ "/bin/coolenv" ]